From 2100f2735f31d8223fa3470574ba01f269189fad Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 5 Apr 2017 17:40:30 +0100 Subject: [PATCH] Add a sysrq option to exit secure boot mode Make sysrq+x exit secure boot mode on x86_64, thereby allowing the running kernel image to be modified. This lifts the lockdown. Signed-off-by: Kyle McMartin Signed-off-by: David Howells [bwh: For 4.12, adjust context] Gbp-Pq: Topic features/all/lockdown Gbp-Pq: Name 0043-Add-a-sysrq-option-to-exit-secure-boot-mode.patch --- arch/x86/Kconfig | 10 ++++++++++ arch/x86/kernel/setup.c | 31 +++++++++++++++++++++++++++++++ drivers/input/misc/uinput.c | 1 + drivers/tty/sysrq.c | 19 +++++++++++++------ include/linux/input.h | 5 +++++ include/linux/sysrq.h | 8 +++++++- kernel/debug/kdb/kdb_main.c | 2 +- 7 files changed, 68 insertions(+), 8 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4296e827607..062dbcbd65f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1848,6 +1848,16 @@ config EFI_SECURE_BOOT_LOCK_DOWN image. Say Y here to automatically lock down the kernel when a system boots with UEFI Secure Boot enabled. +config EFI_ALLOW_SECURE_BOOT_EXIT + def_bool n + depends on EFI_SECURE_BOOT_LOCK_DOWN && MAGIC_SYSRQ + select ALLOW_LOCKDOWN_LIFT + prompt "Allow secure boot mode to be exited with SysRq+x on a keyboard" + ---help--- + Allow secure boot mode to be exited and the kernel lockdown lifted by + typing SysRq+x on a keyboard attached to the system (not permitted + through procfs). + config SECCOMP def_bool y prompt "Enable seccomp to safely compute untrusted bytecode" diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d0128aef43c..d7e8b983aa7 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -71,6 +71,11 @@ #include #include +#include +#include +#include +#include + #include #include